package com.tiandang.controller;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tiandang.core.model.WXFormid;
import tiandang.core.response.CommonReturnType;
import tiandang.core.service.WXService;

@RestController
@RequestMapping("/wechat/formid")
public class FormidController {

  @Autowired
  private WXService wxService;

  @PostMapping("/add")
  public CommonReturnType add(WXFormid wxFormid) {
    if (wxFormid.getManagerId() != null && StringUtils.isNotBlank(wxFormid.getFormId()) && StringUtils.isNotBlank(wxFormid.getOpenid())) {
      wxService.saveFormid(wxFormid);
    }
    return CommonReturnType.success();
  }

}
